VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{B3FB64BF-91F9-11D7-A482-0008A14158BC}#2.22#0"; "ITGControls.ocx"
Begin VB.Form frmBasicAPCheckIssuance 
   BackColor       =   &H00F7D9C2&
   BorderStyle     =   0  'None
   Caption         =   "Form1"
   ClientHeight    =   7350
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   11280
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MDIChild        =   -1  'True
   ScaleHeight     =   7350
   ScaleWidth      =   11280
   ShowInTaskbar   =   0   'False
   Begin MSComctlLib.StatusBar sbRS 
      Align           =   2  'Align Bottom
      Height          =   285
      Left            =   0
      TabIndex        =   15
      Top             =   7065
      Width           =   11280
      _ExtentX        =   19897
      _ExtentY        =   503
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   5
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Alignment       =   1
            AutoSize        =   1
            Bevel           =   0
            Object.Width           =   6670
            MinWidth        =   2
         EndProperty
         BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel5 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin ITGControls.ITGTab SSTab1 
      Height          =   2960
      Left            =   30
      TabIndex        =   16
      Top             =   30
      Width           =   11205
      _ExtentX        =   19764
      _ExtentY        =   5212
      TabCount        =   2
      TabCaption(0)   =   "               Main               "
      TabContCtrlCnt(0)=   1
      Tab(0)ContCtrlCap(1)=   "ComunionFrames1"
      TabCaption(1)   =   "               List               "
      TabContCtrlCnt(1)=   1
      Tab(1)ContCtrlCap(1)=   "dtgList"
      TabTheme        =   2
      ActiveTabBackStartColor=   16250865
      ActiveTabBackEndColor=   16243138
      InActiveTabBackStartColor=   16243138
      InActiveTabBackEndColor=   16243138
      InActiveTabForeColor=   0
      BeginProperty ActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty InActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      OuterBorderColor=   4210752
      TopLeftInnerBorderColor=   4210752
      BottomRightInnerBorderColor=   4210752
      DisabledTabBackColor=   16243138
      DisabledTabForeColor=   -2147483630
      Begin MSDataGridLib.DataGrid dtgList 
         Height          =   3210
         Left            =   -75000
         TabIndex        =   4
         Top             =   315
         Width           =   11205
         _ExtentX        =   19764
         _ExtentY        =   5662
         _Version        =   393216
         AllowUpdate     =   0   'False
         AllowArrows     =   -1  'True
         Appearance      =   0
         HeadLines       =   1
         RowHeight       =   15
         TabAction       =   2
         FormatLocked    =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   6
         BeginProperty Column00 
            DataField       =   "cCompanyID"
            Caption         =   "Company"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "cCheckNo"
            Caption         =   "Check No."
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "cBankID"
            Caption         =   "Bank"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column03 
            DataField       =   "dCheckDate"
            Caption         =   "Date"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "MM/dd/yyyy"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   3
            EndProperty
         EndProperty
         BeginProperty Column04 
            DataField       =   "nApplied"
            Caption         =   "Amount"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
         EndProperty
         BeginProperty Column05 
            DataField       =   "cPaidTo"
            Caption         =   "Paid To"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
               Locked          =   -1  'True
            EndProperty
            BeginProperty Column01 
               Locked          =   -1  'True
            EndProperty
            BeginProperty Column02 
               Locked          =   -1  'True
            EndProperty
            BeginProperty Column03 
               Locked          =   -1  'True
            EndProperty
            BeginProperty Column04 
               Alignment       =   1
               Locked          =   -1  'True
            EndProperty
            BeginProperty Column05 
               Locked          =   -1  'True
            EndProperty
         EndProperty
      End
      Begin ITGControls.ComunionFrames ComunionFrames1 
         Height          =   2680
         Left            =   0
         Top             =   315
         Width           =   11205
         _ExtentX        =   19764
         _ExtentY        =   4736
         FrameColor      =   4210752
         BackColor       =   16243138
         FillColor       =   16243138
         RoundedCorner   =   0   'False
         Caption         =   "Issuance Information"
         Alignment       =   0
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ThemeColor      =   5
         ColorFrom       =   16243138
         ColorTo         =   16250865
         Begin VB.CommandButton cmdPickCompany 
            Height          =   300
            Left            =   3210
            Picture         =   "frmBasicAPCheckIssuance.frx":0000
            Style           =   1  'Graphical
            TabIndex        =   1
            Top             =   555
            Width           =   315
         End
         Begin VB.CommandButton cmdPickBank 
            Height          =   300
            Left            =   3210
            Picture         =   "frmBasicAPCheckIssuance.frx":014A
            Style           =   1  'Graphical
            TabIndex        =   6
            Top             =   1185
            Width           =   315
         End
         Begin VB.Timer Timer1 
            Interval        =   300
            Left            =   1440
            Top             =   840
         End
         Begin ITGControls.ITGTextBox txtCheckNo 
            Height          =   285
            Left            =   165
            TabIndex        =   8
            TabStop         =   0   'False
            Top             =   1485
            Width           =   3015
            _ExtentX        =   5106
            _ExtentY        =   503
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   "Check/CB No."
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1200
            TextBoxWidth    =   1755
         End
         Begin ITGControls.ITGDateBox dtbCheckDate 
            Height          =   285
            Left            =   7575
            TabIndex        =   10
            Top             =   1485
            Width           =   1590
            _ExtentX        =   2805
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            SendKeysTab     =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtBankID 
            Height          =   285
            Left            =   165
            TabIndex        =   5
            TabStop         =   0   'False
            Top             =   1185
            Width           =   3015
            _ExtentX        =   5106
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Bank"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1200
            TextBoxWidth    =   1755
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtBankName 
            Height          =   285
            Left            =   3525
            TabIndex        =   7
            TabStop         =   0   'False
            Top             =   1185
            Width           =   5640
            _ExtentX        =   9948
            _ExtentY        =   503
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   ""
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   5580
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGTextBox txtCompanyID 
            Height          =   285
            Left            =   165
            TabIndex        =   0
            Top             =   555
            Width           =   3015
            _ExtentX        =   5106
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Company Code"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1200
            TextBoxWidth    =   1755
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtCompanyName 
            Height          =   285
            Left            =   3530
            TabIndex        =   2
            TabStop         =   0   'False
            Top             =   555
            Width           =   4040
            _ExtentX        =   7038
            _ExtentY        =   503
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   ""
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   3990
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGTextBox txtPaidTo 
            Height          =   285
            Left            =   165
            TabIndex        =   11
            Top             =   1785
            Width           =   9000
            _ExtentX        =   15875
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   "Paid To"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1200
            TextBoxWidth    =   7740
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtAmount 
            Height          =   285
            Left            =   6330
            TabIndex        =   13
            Top             =   2085
            Width           =   2835
            _ExtentX        =   4789
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   "0.00"
            DataType        =   1
            DecimalPlace    =   2
            Label           =   "Total Amount"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1200
            TextBoxWidth    =   1575
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtApplied 
            Height          =   285
            Left            =   6330
            TabIndex        =   17
            TabStop         =   0   'False
            Top             =   2085
            Width           =   2835
            _ExtentX        =   4789
            _ExtentY        =   503
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   "0.00"
            DataType        =   1
            DecimalPlace    =   2
            Label           =   "Total Applied"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1200
            TextBoxWidth    =   1575
            Enabled         =   0   'False
            LinkForeColor   =   0
         End
         Begin ITGControls.ITGTextBox txtBankAcctNo 
            Height          =   285
            Left            =   165
            TabIndex        =   12
            TabStop         =   0   'False
            Top             =   2085
            Width           =   3375
            _ExtentX        =   5741
            _ExtentY        =   503
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   "Account No."
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1200
            TextBoxWidth    =   2115
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGTextBox txtCheckBookNo 
            Height          =   285
            Left            =   3165
            TabIndex        =   9
            TabStop         =   0   'False
            Top             =   1485
            Width           =   1515
            _ExtentX        =   2566
            _ExtentY        =   503
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   "Account No."
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   1455
         End
         Begin ITGControls.ITGDateBox dtbDate 
            Height          =   285
            Left            =   7580
            TabIndex        =   3
            Top             =   870
            Width           =   1590
            _ExtentX        =   2805
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
            SendKeysTab     =   -1  'True
         End
         Begin VB.Label Label2 
            BackStyle       =   0  'Transparent
            Caption         =   "Check Date"
            BeginProperty Font 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   300
            Left            =   6345
            TabIndex        =   19
            Top             =   1530
            Width           =   840
         End
         Begin VB.Label Label1 
            BackStyle       =   0  'Transparent
            Caption         =   "Date"
            BeginProperty Font 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   6345
            TabIndex        =   18
            Top             =   915
            Width           =   915
         End
      End
   End
   Begin ITGControls.ComunionFrames ComunionFrames2 
      Height          =   3000
      Left            =   30
      Top             =   2985
      Width           =   11205
      _ExtentX        =   19764
      _ExtentY        =   5292
      FrameColor      =   4210752
      BackColor       =   16243138
      FillColor       =   16243138
      RoundedCorner   =   0   'False
      Caption         =   "Details"
      Alignment       =   0
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ThemeColor      =   5
      ColorFrom       =   16243138
      ColorTo         =   16250865
      Begin MSDataGridLib.DataGrid dtgVoucher 
         Height          =   2580
         Left            =   0
         TabIndex        =   14
         Top             =   420
         Width           =   11205
         _ExtentX        =   19764
         _ExtentY        =   4551
         _Version        =   393216
         AllowUpdate     =   -1  'True
         AllowArrows     =   -1  'True
         Appearance      =   0
         HeadLines       =   1
         RowHeight       =   15
         TabAction       =   1
         FormatLocked    =   -1  'True
         AllowDelete     =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   4
         BeginProperty Column00 
            DataField       =   "cVoucherNo"
            Caption         =   "Voucher No."
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "dDate"
            Caption         =   "Date"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "MM/dd/yyyy"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   3
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "nAmount"
            Caption         =   "Voucher Amount"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
         EndProperty
         BeginProperty Column03 
            DataField       =   "nApplied"
            Caption         =   "Applied"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
               Button          =   -1  'True
               ColumnWidth     =   1665.071
            EndProperty
            BeginProperty Column01 
               Locked          =   -1  'True
            EndProperty
            BeginProperty Column02 
               Alignment       =   1
               Locked          =   -1  'True
               ColumnWidth     =   1769.953
            EndProperty
            BeginProperty Column03 
               Alignment       =   1
               ColumnWidth     =   1904.882
            EndProperty
         EndProperty
      End
   End
End
Attribute VB_Name = "frmBasicAPCheckIssuance"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private oPrint As New clsPrinting

Private WithEvents rsHeader As ADODB.Recordset
Attribute rsHeader.VB_VarHelpID = -1
Private rsDetail As ADODB.Recordset

Private connHeader As ADODB.Connection
Private connDetail As ADODB.Connection

Enum eBasicIssuanceMode
    Normal
    AddNewEdit
    Find
End Enum
Public Mode As eBasicIssuanceMode

Public dtgName As String
Public sBit As String
Private vBM As Variant

Public lACNew As Boolean
Public lACEdit As Boolean
Public lACDelete As Boolean
Public lACPost As Boolean
Public lACCancel As Boolean
Public lACPrint As Boolean

Private Sub cmdPickCompany_Click()
    If lPickListActive Then Exit Sub
    frmITGPickList.mType = Company
    frmITGPickList.Show vbModal
    txtCompanyID = frmITGPickList.mCode
    txtCompanyName = frmITGPickList.mName
    If Trim(txtCompanyName) <> "" Then SendKeys "{Tab}"
End Sub

Private Sub cmdPickBank_Click()
    If lPickListActive Then Exit Sub
    frmITGPickList.mType = Bank
    frmITGPickList.Show vbModal
    txtBankID = frmITGPickList.mCode
    txtBankName = frmITGPickList.mName
    txtCheckNo = frmITGPickList.mRefNo
    txtCheckBookNo.Text = frmITGPickList.mParam
    
    If Trim(txtBankName) <> "" Then
        dtbCheckDate.Text = Format(Date, "MM/dd/yyyy")
        dtbCheckDate.SetFocus
    End If
End Sub

Private Sub dtgVoucher_AfterColUpdate(ByVal ColIndex As Integer)

    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 3
            ComputeTotal
    End Select

End Sub

Private Sub dtgVoucher_ButtonClick(ByVal ColIndex As Integer)
On Error GoTo ErrorHandler
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 0
            frmARCollectionList.mSIPick = ToIssuance
            frmARCollectionList.Show vbModal
            ComputeTotal
    End Select
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

Private Sub dtgVoucher_Click()
    If Mode = AddNewEdit Then dtgName = dtgVoucher.Name
End Sub

Private Sub dtgVoucher_Error(ByVal DataError As Integer, Response As Integer)
    Response = 0
End Sub

Private Sub dtgVoucher_GotFocus()
    dtgName = dtgVoucher.Name
End Sub

Private Sub dtgVoucher_KeyDown(KeyCode As Integer, Shift As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If (Shift = vbCtrlMask And KeyCode = 45) Then
        TBNewLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 46) Then
        TBDeleteLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 83) Then
        TBSave
    End If
End Sub

Private Sub dtgVoucher_KeyPress(KeyAscii As Integer)
On Error GoTo ErrorHandler
    If Mode <> AddNewEdit Then Exit Sub
    If rsDetail.RecordCount = 0 Then Exit Sub

    If KeyAscii = 39 Then KeyAscii = 0

    If KeyAscii = 13 Then
        Select Case dtgVoucher.Col
            Case 0
                sSQL = "SELECT A.cTranNo, (A.nTDebit - A.nTCredit) AS nBalance FROM VOUCHER A " & _
                        "WHERE A.cTranNo = '" & Trim(dtgVoucher.Columns(0).Text) & "' " & _
                        "AND A.cCompanyID = '" & Trim(txtCompanyID) & "' " & _
                        "AND ((A.nTDebit - A.nTCredit) <> 0) AND A.lCancelled = 0 "
                Set rs = New Recordset
                rs.Open sSQL, cn, adOpenForwardOnly, adLockReadOnly
                If rs.RecordCount = 0 Then
                    dtgVoucher.Col = 0
                    dtgVoucher_ButtonClick 0
                Else
                    rsDetail!dDate = GetValueFrTable("dDate", "VOUCHER", "cTranNo = '" & Trim(dtgVoucher.Columns(0).Text) & "' AND cCompanyID = '" & Trim(txtCompanyID) & "' ", True)
                    rsDetail!nAmount = rs!nBalance
                    dtgVoucher.Col = 3
                    dtgVoucher.Columns(3).Value = rs!nBalance
                    rsDetail!cVoucherNo = rs!cTranNo
                End If
                Set rs = Nothing
            Case 3
                TBNewLine
                dtgVoucher.LeftCol = 0
            Case Else
                SendKeys "{Tab}"
        End Select
    Else
        KeyAscii = Asc(UCase(Chr(KeyAscii)))
    End If
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

Private Sub dtgVoucher_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Mode <> AddNewEdit Then Exit Sub
    If Button = 2 Then
        dtgName = dtgVoucher.Name
        PopupMenu ITGLedgerMain.mnuDetail
    End If
End Sub

Private Sub dtgList_HeadClick(ByVal ColIndex As Integer)
    SortGrid dtgList, ColIndex, rsHeader
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Dim iKey As Integer
    iKey = ToolbarIndex(KeyCode, Shift)
    If iKey <> 0 Then
        If ITGLedgerMain.tbrMain.Buttons(iKey).Enabled = True Then
            ToolbarFunction iKey
        End If
    End If
End Sub

Private Sub Form_Load()
    Set FrmName = Me
    FormSetup
    
    AcessBit Me, GetValueFrTable("AccessLevel", "SEC_ACCESSLEVEL", "RoleID = '" & SecUserRole & "' AND [Module] = 'BAP06'")
    
    Set rsHeader = New ADODB.Recordset
    Set rsDetail = New ADODB.Recordset
    
    FormLocking True
    FormSearch True
    SearchObj True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    BitVisible ITGLedgerMain.tbrMain, True, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True

    Mode = Find
    txtCompanyID.Locked = False
    
End Sub

Private Sub Form_Activate()
    TBBitReload
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
    If Mode = AddNewEdit Then
        MsgBox "Unable to close. You are in Add/New/Edit mode." & vbCr & _
            " Must Save or Undo", vbCritical, Me.Caption
        Cancel = True
        Exit Sub
    End If
    
    CloseMenuTab ITGLedgerMain
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True
    BitVisible ITGLedgerMain.tbrMain
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = False
    
    Set rsHeader = Nothing
    Set rsDetail = Nothing
    Set connHeader = Nothing
    Set connDetail = Nothing
    
    Set frmBasicAPCheckIssuance = Nothing

    lCloseWindow = True
    
    'oForm(Me.Tag).Mode = 1
    'oForm(Me.Tag).Tag = Me.Tag
End Sub

Public Sub TBNew()
On Error GoTo ErrorHandler
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
    txtCompanyID.BackColor = &HE0FFFF
    Mode = AddNewEdit

    If rsHeader.State <> adStateOpen Then
        OpenNewConnection connHeader
        OpenNewConnection connDetail
        OpenRecordsetWithCN rsDetail, "*", "ISSUED_T", connDetail, "WHERE 1 = 0", True
        OpenRecordsetWithCN rsHeader, "*", "ISSUED", connHeader, "WHERE 1 = 0", True
        SetDataSource
        SetDataField
    Else
        vBM = rsHeader.Bookmark
    End If

    rsHeader.AddNew
    rsHeader!dDate = Date
    
    Set FrmName = Me
    FormLocking False
    ClrRequired &HC0&
    SSTab1.ActiveTab = 0
    txtCompanyID.SetFocus
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

Public Sub TBUndoAll()
On Error GoTo ErrorHandler

    Mode = Normal
    
    If rsHeader.Status = adRecNew Then TBUndoCurrent
    
    rsHeader.CancelBatch adAffectAll
    rsDetail.CancelBatch adAffectAll
    
    UnbindControls
    
    If rsHeader.RecordCount <> 0 Then rsHeader.Bookmark = vBM
    
    Set FrmName = Me
    FormLocking True
    
    If rsHeader.RecordCount <> 0 Then
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, , , , , lACCancel, , , True, True, lACPrint, True
    Else
        RSZero
        Mode = Find
    End If

    sbRS.Panels(2) = ""
    
    SetDataSource
    SetDataField

ErrorHandler:

    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then
        TBUndoAll
    End If

End Sub

Public Sub TBUndoCurrent()
On Error GoTo ErrorHandler

    GetChild
    If rsHeader.Status = adRecNew Then
        rsDetail.CancelBatch adAffectAll
        rsHeader.CancelUpdate
    Else
        rsHeader.CancelBatch adAffectCurrent
        rsDetail.CancelBatch adAffectAll
    End If
   
    If rsHeader.RecordCount = 0 Then RSZero
    
ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then
        TBUndoCurrent
    End If

End Sub

Public Sub TBSave()
Dim OKUpdate As Boolean
On Error GoTo ErrHandler

    lBoolean = False
    If rsHeader.Status = adRecNew Then lBoolean = True
    
    If rsHeader.Status = adRecNew Then

    End If
    
    If Not MandatoryOK Then Exit Sub
    
    OKUpdate = False
    cn.BeginTrans
    connHeader.BeginTrans
    connDetail.BeginTrans
    
    rsHeader.UpdateBatch adAffectAll
    rsDetail.UpdateBatch adAffectAll
    
    cn.CommitTrans
    connHeader.CommitTrans
    connDetail.CommitTrans
    OKUpdate = True
    
    Set FrmName = Me
    FormLocking True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, , , , , lACCancel, , , True, True, , True
    Mode = Normal
        
    MsgBox "Record/s successfully saved.", vbInformation, msgTtl
    sbRS.Panels(2) = ""
    
    If rsDetail.RecordCount <> 0 Then UpdateVoucher
    
    If lBoolean Then UpdateCheckBooklet
        
    UpdateLogFile "Issuance", Trim(txtCheckNo) & "-" & Trim(txtBankID), IIf(lBoolean, "Inserted", "Updated")

    If lBoolean = False Then ' Edit
        cn.Execute ("UPDATE ISSUED SET dUpdated = GETDATE () WHERE cCompanyID = '" & Trim(txtCompanyID) & "' AND cCheckNo = '" & Trim(txtCheckNo) & "' AND cBankID = '" & Trim(txtBankID) & "'")
    Else ' Insert
        cn.Execute ("UPDATE ISSUED SET dUpdated = GETDATE () WHERE cCompanyID = '" & Trim(txtCompanyID) & "' AND cCheckNo = '" & Trim(txtCheckNo) & "' AND cBankID = '" & Trim(txtBankID) & "'")
    End If
    
    'GL
    If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
    Do Until rsDetail.EOF
        UpdateGLA "Update", "VOU", Trim(rsDetail!cVoucherNo)
        rsDetail.MoveNext
    Loop



ErrHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217864 Then
        OKUpdate = True
        cn.RollbackTrans
        connHeader.RollbackTrans
        connDetail.RollbackTrans
        MsgBox "Record cannot be updated. Some values may have been changed by other user/s since last read." & vbCr & _
                "Records will be automatically refreshed. All changes made to the record will be gone upon refresh.", vbInformation, msgTtl
        vBookMark = rsHeader.Bookmark
        UnbindControls
        rsHeader.Requery
        rsDetail.Requery
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, , , , , lACCancel, , , True, True, lACPrint, True
        Mode = Normal
        If rsHeader.RecordCount <> 0 Then
            Set FrmName = Me
            FormLocking True
            SetDataField
            SetDataSource
            rsHeader.Bookmark = vBookMark
        Else
            RSZero
        End If
    End If
    If Not OKUpdate Then
        MsgBox "Transaction update failed.", vbInformation, msgTtl
        cn.RollbackTrans
        connHeader.RollbackTrans
        connDetail.RollbackTrans
        ErrorLog err.Number, err.Description, Me.Name
    End If
    
End Sub

Public Sub TBEdit()
On Error GoTo ErrorHandler
    If rsHeader!lCancelled = True Then
        MsgBox "Transaction was already cancelled. Edit is not allowed.", vbExclamation, msgTtl
        Exit Sub
    End If
    Mode = AddNewEdit
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
    Set FrmName = Me
    FormLocking False
    ClrRequired &HC0&
    txtCompanyID.Locked = True
    SSTab1.ActiveTab = 0
    dtbDate.SetFocus
    vBM = rsHeader.Bookmark
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

Public Sub TBDelete()
End Sub

Public Sub TBFind()
    Mode = Normal
    txtCompanyID.Locked = True
    frmITGSearch.Show
    End Sub

Public Sub TBFindPrimary()
On Error GoTo ErrorHandler
Dim sTemp As String
If Mode = Find Then
    FormWaitShow App.Path & "\Transmit.avi", "Loading data . . ."

    OpenNewConnection connHeader
    OpenNewConnection connDetail
    
    Set rsHeader = Nothing
    Set rsDetail = Nothing
    Set rsHeader = New ADODB.Recordset
    Set rsDetail = New ADODB.Recordset

    sTemp = Trim$(GetSearchString)
    If sTemp = "ERROR" Then
        MsgBox "Only Allows A - Z, 0 - 9, '.', ',' and %(wildcard)", vbExclamation, ""
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
        txtCompanyID.Locked = False
        txtCompanyID.SetFocus
        Exit Sub
    End If
    
    OpenRecordsetWithCN rsHeader, "*", "ISSUED", connHeader, IIf(sTemp = "", "", " WHERE " & sTemp)
           
    OpenRecordsetWithCN rsDetail, "*", "ISSUED_T", connDetail, IIf(sTemp = "", "", " WHERE cCheckNo IN (SELECT cCheckNo FROM ISSUED WHERE " & sTemp & ")")
       
    Set FrmName = Me
    FormLocking True

    If rsHeader.RecordCount = 0 Then
        FormWaitHide
        MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
        RSZero
        FormSearch True
        SearchObj True
        Mode = Find
        Exit Sub
    End If
    SetDataSource
    SetDataField
    txtCompanyID.BackColor = &HE0FFFF
    Mode = Normal
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, , , , , lACCancel, , , True, True, , True

    FormWaitHide
Else
    RSZero
    FormSearch True
    SearchObj True
    Mode = Find
    
   
End If
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

Public Sub TBBitReload()
    BitVisible ITGLedgerMain.tbrMain, True, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True
    BitReload ITGLedgerMain, Me, ITGLedgerMain.tbrMain, sBit
    Set FrmName = Me
    dtgName = dtgVoucher.Name
End Sub

Public Sub TBCloseWindow()
    Unload Me
End Sub

Public Sub TBFirstRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveFirst rsHeader
    
End Sub

Public Sub TBPrevRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MovePrevious rsHeader

End Sub

Public Sub TBNextRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveNext rsHeader

End Sub

Public Sub TBLastRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveLast rsHeader

End Sub

Public Sub TBNewLine()
On Error GoTo ErrorHandler
    If rsHeader!cCompanyID = "" Then
        MsgBox "Please specify company.", vbInformation, msgTtl
        txtCompanyID.SetFocus
        Exit Sub
    ElseIf rsHeader!cCheckNo = "" Then
        MsgBox "Incomplete Check Details.", vbInformation, msgTtl
        txtBankID.SetFocus
        Exit Sub
    ElseIf rsHeader!cBankID = "" Then
        MsgBox "Incomplete Check Details.", vbInformation, msgTtl
        txtBankID.SetFocus
        Exit Sub
    ElseIf rsHeader.Status = adRecNew Then
        If CheckExisting(Trim(rsHeader!cCheckNo), Trim(rsHeader!cBankID)) Then
            MsgBox "Check No. already exist.", vbInformation, msgTtl
            txtBankID.SetFocus
            Exit Sub
        End If
    End If
    
    If dtgName = "dtgVoucher" Then
        rsDetail.AddNew
        rsDetail!cCompanyID = Trim(rsHeader!cCompanyID)
        rsDetail!cCheckNo = Trim(rsHeader!cCheckNo)
        rsDetail!cBankID = Trim(rsHeader!cBankID)
        dtgVoucher.Col = 0
        dtgVoucher.Columns(0).Value = ""
        GetChild
        If rsDetail.RecordCount <> 0 Then rsDetail.MoveLast
        dtgVoucher.SetFocus
    End If
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

Public Sub TBDeleteLine()
On Error GoTo ErrorHandler

    If dtgName = dtgVoucher.Name Then
        If rsDetail.RecordCount = 0 Then Exit Sub
        vBookMark = dtgVoucher.Bookmark
        GetChild
        dtgVoucher.Bookmark = vBookMark
        rsDetail.Delete adAffectCurrent
        ComputeTotal
    End If
    GetChild

    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

Public Sub TBUndoLineAll()
On Error GoTo ErrorHandler

    MsgBox "Unavailable on " & Me.Name

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

Public Sub TBUndoLineCurrent()
    MsgBox "Unavailable on " & Me.Name
End Sub

Public Sub TBPostRecord()
    MsgBox "Unavailable on " & Me.Name
End Sub

Public Sub TBCancelRecord()
On Error GoTo ErrorHandler
    
    If rsHeader.RecordCount = 0 Then Exit Sub

    If rsHeader!lCancelled = True Then
        MsgBox "Transaction was already cancelled.", vbExclamation, msgTtl
        Exit Sub
    End If
    
    If MsgBox("Are you sure you want to cancel this record?", vbQuestion + vbYesNo, msgTtl) = vbNo Then Exit Sub

    cn.Execute ("UPDATE ISSUED SET dUpdated = GETDATE () WHERE cCompanyID = '" & Trim(txtCompanyID) & "' AND cCheckNo = '" & Trim(txtCheckNo) & "' AND cBankID = '" & Trim(txtBankID) & "'")

    DeleteChecksOnVoucher
    
    UpdateLogFile "Issuance", Trim(txtCheckNo) & "-" & Trim(txtBankID), "Cancelled"

    cn.Execute ("UPDATE ISSUED SET lCancelled = 1, dCancelledDate = '" & Format(Date, "MM/dd/yyyy") & "' WHERE cCompanyID = '" & Trim(txtCompanyID) & "' AND cCheckNo = '" & Trim(txtCheckNo) & "' AND cBankID = '" & Trim(txtBankID) & "'")
    
    sbRS.Panels(5) = "CANCELLED"
    Mode = Normal
    
    rsHeader!lCancelled = True
    rsHeader.UpdateBatch adAffectAll

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

Public Sub TBPrintRecord()
    If Trim(txtCheckNo.Text) = "" Then Exit Sub
    cModule = "Check_Clearing"
    RepName = txtCompanyID.Text
    oPrint.PrintReceipt Trim(txtCheckNo.Text)
End Sub

Sub SetDataSource()
    Set FrmName = Me
    BindControls rsHeader
    Set dtgList.DataSource = rsHeader
    Set dtgVoucher.DataSource = rsDetail
      
End Sub

Sub SetDataField()
On Error GoTo ErrorHandler
    With rsHeader
        txtCompanyID.DataField = !cCompanyID
        dtbDate.DataField = !dDate
        txtBankID.DataField = !cBankID
        txtCheckNo.DataField = !cCheckNo
        txtCheckBookNo.DataField = !cCheckBookno
        dtbCheckDate.DataField = !dCheckDate
        txtPaidTo.DataField = !cPaidTo
        txtAmount.DataField = !nAmount
        txtApplied.DataField = !nApplied
    End With
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub



Private Sub rsHeader_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
On Error GoTo ErrorHandler

    If Not (rsHeader.EOF) Or Not (rsHeader.BOF) Then
        sbRS.Panels(1) = "Record: " & IIf((rsHeader.AbsolutePosition = -2), "0", rsHeader.AbsolutePosition) & "/" & rsHeader.RecordCount

        If rsHeader.Status <> adRecNew Then
            txtCompanyID.Locked = True
        Else
            txtCompanyID.Locked = False
        End If

        If Mode = AddNewEdit Then
            Select Case rsHeader.Status
                Case adRecNew
                    sbRS.Panels(2) = "New"
                Case adRecModified
                    sbRS.Panels(2) = "Modified"
                Case Else
                    sbRS.Panels(2) = ""
            End Select
        Else
            sbRS.Panels(2) = ""
        End If
        
        GetChild
        
        If rsHeader!lCancelled = True Then
            sbRS.Panels(5) = "CANCELLED"
        ElseIf rsHeader!lApproved = True Then
            sbRS.Panels(5) = "APPROVED"
        Else
            sbRS.Panels(5) = ""
        End If
    Else
        sbRS.Panels(1) = "Record: 0/0"
        sbRS.Panels(2) = ""
        txtCompanyID.Locked = False
    End If

    If Mode = AddNewEdit Then
        dtgVoucher.Refresh
    End If

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

Private Sub Timer1_Timer()
    If Mode = AddNewEdit Then
        SSTab1.TabEnabled(1) = False
    Else
        SSTab1.TabEnabled(1) = True
    End If
End Sub

Private Sub txtAmount_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If rsDetail.RecordCount = 0 Then TBNewLine
End Sub

Private Sub txtApplied_Change()
    txtAmount = txtApplied
End Sub

Private Sub txtBankID_Change()
    txtBankName = ""
    txtBankName = GetValueFrTable("cBankName", "BANK", "cBankID = '" & Trim(txtBankID) & "'")
    Me.txtBankAcctNo = GetValueFrTable("cBankAcct", "BANK", "cBankID = '" & Trim(txtBankID) & "'")
End Sub

Private Sub txtBankID_KeyPress(KeyAscii As Integer)
    KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub

Private Sub txtCompanyID_Change()
    txtCompanyName = ""
    txtCompanyName = GetValueFrTable("cCompanyName", "COMPANY", "cCompanyID = '" & Trim(txtCompanyID) & "'", True)
    sUnitId = Trim(txtCompanyID)
End Sub

Private Sub txtCompanyID_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If Trim(txtCompanyName) = "" And Trim(txtCompanyID) <> "" Then cmdPickCompany_Click
End Sub

Function MandatoryOK() As Boolean

    MandatoryOK = True

    If Trim(txtCompanyID) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Transaction Number' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        txtCompanyID.SetFocus
        Exit Function
    End If
    
    ComputeTotal
    If CDbl(txtApplied) <> CDbl(txtAmount) Then
        MsgBox "Unbalanced transaction!", vbCritical, msgTtl
        MandatoryOK = False
        Exit Function
    End If
    
    If rsHeader.Status = adRecNew Then
        If CheckExisting(Trim(rsHeader!cCheckNo), Trim(rsHeader!cBankID)) Then
            MandatoryOK = False
            MsgBox "Check No. already exist.", vbInformation, msgTtl
            cmdPickBank.SetFocus
            Exit Function
        End If
    End If

    If Trim(dtbDate.Text) = "__/__/____" Then
        MandatoryOK = False
        MsgBox "Field 'Transaction Date' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        dtbDate.SetFocus
        Exit Function
    ElseIf Trim(txtBankID) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Bank' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        cmdPickBank.SetFocus
        Exit Function
    ElseIf Trim(dtbCheckDate.Text) = "__/__/____" Then
        MandatoryOK = False
        MsgBox "Field 'Check Date' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        dtbCheckDate.SetFocus
        Exit Function
    End If
    
    GetChild
    
    If rsDetail.RecordCount < 1 Then
        MsgBox "Cannot save transaction without details.", vbExclamation, msgTtl
        MandatoryOK = False
        Exit Function
    End If
    
    
    GetChild
        
    If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
    Do Until rsDetail.EOF
        If rsDetail.Status = (adRecNew) Or rsDetail.Status = (adRecModified) Then
            If IsNull(rsDetail!cVoucherNo) Then
                rsDetail.Delete
            ElseIf Trim(rsDetail!cVoucherNo) = "" Then
                rsDetail.Delete
            Else
                rsDetail.MoveNext
            End If
        Else
            rsDetail.MoveNext
        End If
    Loop

    GetChild
        If rsDetail.RecordCount < 1 Then
        MsgBox "Cannot save transaction without details.", vbExclamation, msgTtl
        MandatoryOK = False
        Exit Function
    End If
    
    If rsDetail.RecordCount <> 0 Then
        rsDetail.MoveFirst
        Do Until rsDetail.EOF
            rsDetail!nIdentity = rsDetail.AbsolutePosition
            rsDetail.MoveNext
        Loop
    End If
End Function

Private Sub GetChild()
    rsDetail.Filter = "cCompanyID = '" & Trim(rsHeader!cCompanyID) & "' AND cCheckNo = '" & Trim(rsHeader!cCheckNo) & "' AND cBankID = '" & Trim(rsHeader!cBankID) & "'"
End Sub

Private Function GetSearchString() As String
On Error GoTo ErrorHandler
Dim sWhere As String

    GetSearchString = True

    If Trim$(txtCompanyID.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cCompanyID LIKE '" & Trim$(txtCompanyID.Text) & "%'"
    End If

    If Trim$(dtbDate.Text) <> "__/__/____" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " dDate = '" & Trim$(dtbDate.Text) & "'"
    End If
    
    If Trim$(txtBankID.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cBankID LIKE '" & Trim$(txtBankID.Text) & "%'"
    End If
    
    GetSearchString = Trim$(sWhere)

    Exit Function
ErrorHandler:
    GetSearchString = "ERROR"
End Function

Private Sub RSZero()
    sbRS.Panels(1) = "Record: 0/0"
    sbRS.Panels(2) = ""
    sbRS.Panels(4) = ""
    sbRS.Panels(5) = ""
    
    Set dtgVoucher.DataSource = Nothing
    dtgVoucher.Refresh
    
    Set FrmName = Me
    UnbindControls
    TextClearing
    FormLocking True
    
    If rsHeader.State = adStateOpen Then rsHeader.Close
    If rsDetail.State = adStateOpen Then rsDetail.Close
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    
    txtCompanyID.Locked = False
    txtCompanyID.SetFocus
    
    Mode = Find
    
End Sub

Sub SearchObj(lEnable As Boolean)
    cmdPickCompany.Enabled = lEnable
    dtbDate.Enabled = lEnable
    cmdPickBank.Enabled = lEnable
End Sub

Sub ComputeTotal()
Dim n As Double
On Error Resume Next
    
    If Mode <> AddNewEdit Then Exit Sub
    
    n = 0
    
    Set rs = New Recordset
    Set rs = rsDetail.Clone
    rs.Filter = "cCompanyID = '" & Trim(rsHeader!cCompanyID) & "' AND cCheckNo = '" & Trim(rsHeader!cCheckNo) & "' AND cBankID = '" & Trim(rsHeader!cBankID) & "'"

    rs.MoveFirst
    Do Until rs.EOF
        n = n + IIf(IsNull(rs!nApplied), 0, rs!nApplied)
        rs.MoveNext
    Loop
    Set rs = Nothing
    
    rsHeader!nApplied = n
    
End Sub

Private Function CheckExisting(CheckNo As String, Bank As String) As Boolean

    CheckExisting = False
    
    sSQL = "SELECT cCheckNo FROM ISSUED WHERE cCheckNo = '" & CheckNo & "' AND cBankID = '" & Bank & "'"
    Set rs = New Recordset
    rs.Open sSQL, cn, adOpenForwardOnly, adLockReadOnly
    
    If rs.RecordCount <> 0 Then
        CheckExisting = True
        Set rs = Nothing
        Exit Function
    End If
    Set rs = Nothing
    
End Function
   
Public Sub AddDetailsFromList(VoucherNo As String, VoucherDate As String, VoucherBalance As Double)
On Error GoTo ErrorHandler
    With rsDetail
        !cVoucherNo = Trim(VoucherNo)
        !dDate = Trim(VoucherDate)
        !nAmount = VoucherBalance
        !nApplied = VoucherBalance
        dtgVoucher.Col = 3
        dtgVoucher.Columns(3).Value = !nApplied
    End With
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

'Update Voucher Payment Details
Sub UpdateVoucher()
On Error GoTo ErrorHandler
Dim cmdToVoucher As ADODB.Command
    
    Set cmdToVoucher = New ADODB.Command
    With cmdToVoucher
        .ActiveConnection = cn
        .CommandTimeout = 1000
        .CommandText = "SP_InsertChecksFromIssued"
        .CommandType = adCmdStoredProc
        .Parameters("@tcCompanyID") = Trim(rsHeader!cCompanyID)
        .Parameters("@tcCheckNo") = Trim(rsHeader!cCheckNo)
        .Parameters("@tcBankID") = Trim(rsHeader!cBankID)
        .Execute
    End With
    Set cmdToVoucher = Nothing
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

Sub UpdateCheckBooklet()
On Error GoTo ErrorHandler
Dim sNewCurrent As String
    sNewCurrent = CStr(CDbl(Trim(txtCheckNo)) + 1)
    cn.Execute ("UPDATE BANKCHECK SET cCheckCurrent = '" & sNewCurrent & "' WHERE cBankID = '" & Trim(rsHeader!cBankID) & "' AND cCheckBookNo = '" & Trim(rsHeader!cCheckBookno) & "'")
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

Sub DeleteChecksOnVoucher()
On Error GoTo ErrorHandler
Dim cmdDeleteChk As ADODB.Command
    
    Set cmdDeleteChk = New ADODB.Command
    With cmdDeleteChk
        .ActiveConnection = cn
        .CommandTimeout = 1000
        .CommandText = "SP_DeleteChecksOnVoucher"
        .CommandType = adCmdStoredProc
        .Parameters("@tcCompanyID") = Trim(rsHeader!cCompanyID)
        .Parameters("@tcCheckNo") = Trim(rsHeader!cCheckNo)
        .Parameters("@tcBankID") = Trim(rsHeader!cBankID)
        .Execute
    End With
    Set cmdDeleteChk = Nothing
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub
